<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>办公室：添加用户</title>
	<jsp:include page="/com/common/_js.jsp"></jsp:include>
	<script type="text/javascript">
	$(function() {
		$(".logina").click(function(){
			var obj = new Object();
			
			obj["role"] = $(this).attr("href");
			
			$(":text").each(function(){
				obj[this.name] = $(this).val();
			});
			
			$(":radio:checked").each(function(){
				obj[this.name] = $(this).val();
			});
			
			$.post("officer/userAction!insertUser.jspa", obj, function(json) {
				switch (json.state) {
					case "checkCode":{
						alert("验证码错误");
						break;
					}
					case "checkUserName" :{
						alert("用户名存在");
						break;
					}
					case "checkRole":{
						alert("没有操作权限");
						break;
					}
					case "insert":{
						alert("添加用户成功");
						break;
					}
					default:{
						alert("添加用户失败");
						break;
					}
				}
			}, "json");
			
			return false;
		});
	});
	</script>
</head>
<body>
<div id="web">
	<div id="head"></div>
		<div id="body">
			<div class="container-fluid">
			    <div class="row-fluid">
				    <div class="span2">
				    <jsp:include page="_left.jsp"></jsp:include>
				    </div>
				    <div class="span10">
						<div class="well" style="margin-top: 30px;padding: 8px 0;">
						<ul class="nav nav-list">
		         			<li class="active">
		         				<a href="#" style="font-size: 20px;line-height: 25px;font-weight:bolder;">
		         					<i class="icon-user icon-white"></i> 添加用户</a>
		         			</li>
		       			 </ul>
						<s:form action="userAction!insertUser.jspa" namespace="/officer" cssClass="validate">
							<div class="field control-group">
								<label for="userAction_username">用户名</label>
								<input name="username" id="userAction_username" class="required" type="text">
							</div>
							<div class="field control-group">
								<label for="userAction_name">姓名</label>
								<input name="name" value="" id="userAction_name" type="text">
							</div>
							<div class="field control-group">
								<label for="userAction_code">验证码</label>
								<input name="code" id="userAction_code" type="text">
							</div>
							
							<div style="padding-left: 100px" class="btn-toolbar">
						 	<div class="btn-group">
		      		 			<img alt="验证码" src="common/validateCodeAction!execute.jspa" class="vcimg" style="margin-bottom: 20px;">
		      				</div>
					        <div class="btn-group">
					          <a href="#" data-toggle="dropdown" class="btn btn-primary"><i class="icon-user icon-white"></i> 用户登录</a>
					          <a href="#" data-toggle="dropdown" class="btn btn-primary dropdown-toggle"><span class="caret"></span></a>
					          <ul class="dropdown-menu">
					            <li><a href="3" class="logina"><i class="icon-flag"></i> 导游</a></li>
					            <li><a href="5" class="logina"><i class="icon-th"></i> 内勤</a></li>
					            <li><a href="7" class="logina"><i class="icon-lock"></i> 总经理</a></li>
					            <li class="divider"></li>
					            <li><a href="9" class="logina"><i class="icon-cog"></i> 系统管理</a></li>
					          </ul>
					        </div>
		      			</div>
						</s:form>
					</div>
				    </div>
			    </div>
			</div>
		</div>
		<div id="foot"></div>
	</div>
</body>
</html>